/*
 * XML Type:  XListBox
 * Namespace: http://www.seedwill.com/xul/widget/
 * Java type: com.seedwill.xul.widget.XListBox
 *
 * Automatically generated - do not modify.
 */
package com.seedwill.xul.widget.impl;
/**
 * An XML XListBox(@http://www.seedwill.com/xul/widget/).
 *
 * This is a complex type.
 */
public class XListBoxImpl extends com.seedwill.xul.widget.impl.XInputImpl implements com.seedwill.xul.widget.XListBox
{
    private static final long serialVersionUID = 1L;
    
    public XListBoxImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName ITEMS$0 = 
        new javax.xml.namespace.QName("", "items");
    private static final javax.xml.namespace.QName DEFAULTSELECTEDINDEX$2 = 
        new javax.xml.namespace.QName("", "defaultSelectedIndex");
    private static final javax.xml.namespace.QName DEFAULTSELECTEDITEM$4 = 
        new javax.xml.namespace.QName("", "defaultSelectedItem");
    private static final javax.xml.namespace.QName MUTIPLE$6 = 
        new javax.xml.namespace.QName("", "mutiple");
    
    
    /**
     * Gets array of all "items" elements
     */
    public com.seedwill.xul.core.XPairItem[] getItemsArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(ITEMS$0, targetList);
            com.seedwill.xul.core.XPairItem[] result = new com.seedwill.xul.core.XPairItem[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "items" element
     */
    public com.seedwill.xul.core.XPairItem getItemsArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XPairItem target = null;
            target = (com.seedwill.xul.core.XPairItem)get_store().find_element_user(ITEMS$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "items" element
     */
    public int sizeOfItemsArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(ITEMS$0);
        }
    }
    
    /**
     * Sets array of all "items" element
     */
    public void setItemsArray(com.seedwill.xul.core.XPairItem[] itemsArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(itemsArray, ITEMS$0);
        }
    }
    
    /**
     * Sets ith "items" element
     */
    public void setItemsArray(int i, com.seedwill.xul.core.XPairItem items)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XPairItem target = null;
            target = (com.seedwill.xul.core.XPairItem)get_store().find_element_user(ITEMS$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(items);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "items" element
     */
    public com.seedwill.xul.core.XPairItem insertNewItems(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XPairItem target = null;
            target = (com.seedwill.xul.core.XPairItem)get_store().insert_element_user(ITEMS$0, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "items" element
     */
    public com.seedwill.xul.core.XPairItem addNewItems()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XPairItem target = null;
            target = (com.seedwill.xul.core.XPairItem)get_store().add_element_user(ITEMS$0);
            return target;
        }
    }
    
    /**
     * Removes the ith "items" element
     */
    public void removeItems(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(ITEMS$0, i);
        }
    }
    
    /**
     * Gets array of all "defaultSelectedIndex" elements
     */
    public int[] getDefaultSelectedIndexArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(DEFAULTSELECTEDINDEX$2, targetList);
            int[] result = new int[targetList.size()];
            for (int i = 0, len = targetList.size() ; i < len ; i++)
                result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getIntValue();
            return result;
        }
    }
    
    /**
     * Gets ith "defaultSelectedIndex" element
     */
    public int getDefaultSelectedIndexArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(DEFAULTSELECTEDINDEX$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target.getIntValue();
        }
    }
    
    /**
     * Gets (as xml) array of all "defaultSelectedIndex" elements
     */
    public org.apache.xmlbeans.XmlInt[] xgetDefaultSelectedIndexArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(DEFAULTSELECTEDINDEX$2, targetList);
            org.apache.xmlbeans.XmlInt[] result = new org.apache.xmlbeans.XmlInt[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets (as xml) ith "defaultSelectedIndex" element
     */
    public org.apache.xmlbeans.XmlInt xgetDefaultSelectedIndexArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlInt target = null;
            target = (org.apache.xmlbeans.XmlInt)get_store().find_element_user(DEFAULTSELECTEDINDEX$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return (org.apache.xmlbeans.XmlInt)target;
        }
    }
    
    /**
     * Returns number of "defaultSelectedIndex" element
     */
    public int sizeOfDefaultSelectedIndexArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(DEFAULTSELECTEDINDEX$2);
        }
    }
    
    /**
     * Sets array of all "defaultSelectedIndex" element
     */
    public void setDefaultSelectedIndexArray(int[] defaultSelectedIndexArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(defaultSelectedIndexArray, DEFAULTSELECTEDINDEX$2);
        }
    }
    
    /**
     * Sets ith "defaultSelectedIndex" element
     */
    public void setDefaultSelectedIndexArray(int i, int defaultSelectedIndex)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(DEFAULTSELECTEDINDEX$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.setIntValue(defaultSelectedIndex);
        }
    }
    
    /**
     * Sets (as xml) array of all "defaultSelectedIndex" element
     */
    public void xsetDefaultSelectedIndexArray(org.apache.xmlbeans.XmlInt[]defaultSelectedIndexArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(defaultSelectedIndexArray, DEFAULTSELECTEDINDEX$2);
        }
    }
    
    /**
     * Sets (as xml) ith "defaultSelectedIndex" element
     */
    public void xsetDefaultSelectedIndexArray(int i, org.apache.xmlbeans.XmlInt defaultSelectedIndex)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlInt target = null;
            target = (org.apache.xmlbeans.XmlInt)get_store().find_element_user(DEFAULTSELECTEDINDEX$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(defaultSelectedIndex);
        }
    }
    
    /**
     * Inserts the value as the ith "defaultSelectedIndex" element
     */
    public void insertDefaultSelectedIndex(int i, int defaultSelectedIndex)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = 
                (org.apache.xmlbeans.SimpleValue)get_store().insert_element_user(DEFAULTSELECTEDINDEX$2, i);
            target.setIntValue(defaultSelectedIndex);
        }
    }
    
    /**
     * Appends the value as the last "defaultSelectedIndex" element
     */
    public void addDefaultSelectedIndex(int defaultSelectedIndex)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(DEFAULTSELECTEDINDEX$2);
            target.setIntValue(defaultSelectedIndex);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "defaultSelectedIndex" element
     */
    public org.apache.xmlbeans.XmlInt insertNewDefaultSelectedIndex(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlInt target = null;
            target = (org.apache.xmlbeans.XmlInt)get_store().insert_element_user(DEFAULTSELECTEDINDEX$2, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "defaultSelectedIndex" element
     */
    public org.apache.xmlbeans.XmlInt addNewDefaultSelectedIndex()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlInt target = null;
            target = (org.apache.xmlbeans.XmlInt)get_store().add_element_user(DEFAULTSELECTEDINDEX$2);
            return target;
        }
    }
    
    /**
     * Removes the ith "defaultSelectedIndex" element
     */
    public void removeDefaultSelectedIndex(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(DEFAULTSELECTEDINDEX$2, i);
        }
    }
    
    /**
     * Gets array of all "defaultSelectedItem" elements
     */
    public com.seedwill.xul.core.XPairItem[] getDefaultSelectedItemArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(DEFAULTSELECTEDITEM$4, targetList);
            com.seedwill.xul.core.XPairItem[] result = new com.seedwill.xul.core.XPairItem[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "defaultSelectedItem" element
     */
    public com.seedwill.xul.core.XPairItem getDefaultSelectedItemArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XPairItem target = null;
            target = (com.seedwill.xul.core.XPairItem)get_store().find_element_user(DEFAULTSELECTEDITEM$4, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "defaultSelectedItem" element
     */
    public int sizeOfDefaultSelectedItemArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(DEFAULTSELECTEDITEM$4);
        }
    }
    
    /**
     * Sets array of all "defaultSelectedItem" element
     */
    public void setDefaultSelectedItemArray(com.seedwill.xul.core.XPairItem[] defaultSelectedItemArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(defaultSelectedItemArray, DEFAULTSELECTEDITEM$4);
        }
    }
    
    /**
     * Sets ith "defaultSelectedItem" element
     */
    public void setDefaultSelectedItemArray(int i, com.seedwill.xul.core.XPairItem defaultSelectedItem)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XPairItem target = null;
            target = (com.seedwill.xul.core.XPairItem)get_store().find_element_user(DEFAULTSELECTEDITEM$4, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(defaultSelectedItem);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "defaultSelectedItem" element
     */
    public com.seedwill.xul.core.XPairItem insertNewDefaultSelectedItem(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XPairItem target = null;
            target = (com.seedwill.xul.core.XPairItem)get_store().insert_element_user(DEFAULTSELECTEDITEM$4, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "defaultSelectedItem" element
     */
    public com.seedwill.xul.core.XPairItem addNewDefaultSelectedItem()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XPairItem target = null;
            target = (com.seedwill.xul.core.XPairItem)get_store().add_element_user(DEFAULTSELECTEDITEM$4);
            return target;
        }
    }
    
    /**
     * Removes the ith "defaultSelectedItem" element
     */
    public void removeDefaultSelectedItem(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(DEFAULTSELECTEDITEM$4, i);
        }
    }
    
    /**
     * Gets the "mutiple" attribute
     */
    public boolean getMutiple()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(MUTIPLE$6);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_default_attribute_value(MUTIPLE$6);
            }
            if (target == null)
            {
                return false;
            }
            return target.getBooleanValue();
        }
    }
    
    /**
     * Gets (as xml) the "mutiple" attribute
     */
    public org.apache.xmlbeans.XmlBoolean xgetMutiple()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlBoolean target = null;
            target = (org.apache.xmlbeans.XmlBoolean)get_store().find_attribute_user(MUTIPLE$6);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlBoolean)get_default_attribute_value(MUTIPLE$6);
            }
            return target;
        }
    }
    
    /**
     * True if has "mutiple" attribute
     */
    public boolean isSetMutiple()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(MUTIPLE$6) != null;
        }
    }
    
    /**
     * Sets the "mutiple" attribute
     */
    public void setMutiple(boolean mutiple)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(MUTIPLE$6);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(MUTIPLE$6);
            }
            target.setBooleanValue(mutiple);
        }
    }
    
    /**
     * Sets (as xml) the "mutiple" attribute
     */
    public void xsetMutiple(org.apache.xmlbeans.XmlBoolean mutiple)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlBoolean target = null;
            target = (org.apache.xmlbeans.XmlBoolean)get_store().find_attribute_user(MUTIPLE$6);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlBoolean)get_store().add_attribute_user(MUTIPLE$6);
            }
            target.set(mutiple);
        }
    }
    
    /**
     * Unsets the "mutiple" attribute
     */
    public void unsetMutiple()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(MUTIPLE$6);
        }
    }
}
